import qs from 'qs'
import { axios as request  } from '@/utils/request'

export function getList({params}) {
  return request({
    url: 'api/v2/order?' + qs.stringify(params, {indices: false, encode: false}),
    method: 'get'
  })
}

export function add({data}) {
  return request({
    url: 'api/v2/order',
    method: 'post',
    data
  })
}

export function edit({data}) {
  return request({
    url: 'api/v2/order',
    method: 'put',
    data
  })
}

export function cancel(data) {
  return request({
    url: 'api/v2/order/cancel',
    method: 'post',
    data
  })
}

export function getDetail({id, params}) {
  return request({
    url: `api/v2/order/${id}`,
    method: 'get',
    params
  })
}

export function getEditDetail({ids}) {
  return request({
    url: 'api/v2/order/update/detail' + '?' + qs.stringify({ids}, { indices: false }),
    method: 'get'
  })
}